﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace LiveProjectManager.DDD.Domains
{
    public class File : Base.Domain
    {
        public const int PATH_MAXLENGTH = 255;

        // Primary key of a file.
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public long Id { get; set; }

        // The localizaton of the stored file.
        [Required]
        [StringLength(PATH_MAXLENGTH)]
        public string Path { get; set; }

        // The stored file size (in Bytes?).
        [Required]
        public long Size { get; set; }

        // The creaton date & time of this resource.
        public DateTime CreatedOn { get; set; }

        public virtual ICollection<Resource> Resources { get; set; }


        override public Dictionary<string, object> toDict()
        {
            Dictionary<string, object> myDict = new Dictionary<string, object>();
            myDict.Add("Id", Id);
            myDict.Add("Path", Path);
            myDict.Add("Size", Size);
            myDict.Add("CreatedOn", CreatedOn);
            return myDict;
        }
    }
}